import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '../views/Home.vue'
import Films from '../views/Home/homeFilms.vue'
import ComingSoon from '../views/Home/FilmsList/ComingSoon.vue'
import NowPlaying from '../views/Home/FilmsList/NowPlaying.vue'
import Cinemas from '../views/Home/homeCinemas.vue'
import Center from '../views/Home/homeCenter.vue'
import Informations from '../views/Home/homeInformation.vue'
import Cinema from '../views/Cinema.vue'
import City from '../views/City.vue'
import Film from '../views/Film.vue'
import Information from '../views/Information.vue'
import Login from '../views/Login.vue'

// 调用路由
Vue.use(VueRouter)

// 配置路由规则
const router = new VueRouter({
  routes: [
    {
      path: '/',
      component: Home,
      redirect: '/films',
      children: [
        {
          path: '/films',
          redirect: '/films/nowPlaying',
          component: Films,
          children: [
            {
              path: 'comingSoon',
              name: 'comingSoon',
              component: ComingSoon
            },
            {
              path: 'nowPlaying',
              name: 'nowPlaying',
              component: NowPlaying
            }
          ]
        },
        {
          path: '/cinemas',
          component: Cinemas
        },
        {
          path: '/informations',
          component: Informations
        },
        {
          path: '/center',
          component: Center
        }
      ]
    },
    {
      path: '/cinema',
      component: Cinema
    },
    {
      path: '/city',
      component: City
    },
    {
      path: '/film',
      component: Film
    },
    {
      path: '/information',
      component: Information
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '*',
      redirect: '/films'
    }
  ]
})

// 将routers暴露出去
export default router
